package ru.ifmo.croak.impl.stress.post.team3;

import java.util.Random;
import java.util.UUID;

import ru.ifmo.croak.api.Message;

public class RandomMessage {

	private static final int lettersCount = 26 * 2;
	private static final int autorMaxLen = 20;
	private static final int textMaxLen = 200;

	private static String nextStr(int maxLen) {
		Random rand = new Random();
		int n = rand.nextInt(maxLen);
		String str = "";
		for (int i = 0; i < n; ++i) {
			str += (char) ('A' + rand.nextInt(lettersCount));
		}
		return str;
	}

	public static Message nextMessage() {
		Message temp = new Message();
		temp.setAuthor(nextStr(autorMaxLen));
		temp.setText(nextStr(textMaxLen));
		temp.setTime(System.currentTimeMillis());
		temp.setId(UUID.randomUUID());
		return temp;
	}

}
